We study the behavior of magnetic vortices on a two-dimensional support manifold being not simply connected. It is done by considering the continuum approach of the XY-model on a plane with two disks removed from it. We argue that an effective attractive interaction between the two disks may exist due to the presence of a vortex. The results can be applied to diluted planar ferromagnets with easy-plane anisotropy, where the disks can be seen as nonmagnetic impurities. Simulations are also used to test the predictions of the continuum limit.